
import java.util.Vector;
import javax.microedition.lcdui.Command;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author sherin
 */
public class lib {
    public static Command backCommand = new Command("Back", Command.BACK, 0);
    public static Command mainMenuCommand = new Command("Main", Command.SCREEN, 1);
    public static Command exitCommand = new Command("Exit", Command.STOP, 2);
    public static Command sendCommand = new Command("Send", Command.OK, 3);
    public static Command submit = new Command("Submit", Command.OK, 3);
    public static Command okCommand = new Command( "Ok", Command.OK, 3);
    public static Command modifyCommand = new Command( "Ok", Command.OK, 3);
    
    public static String[] split(String original ) {
        Vector nodes = new Vector();
        String separator = "\n";
 //       System.out.println("split start...................");
        // Parse nodes into vector
        int index = original.indexOf(separator);
        while(index>=0) {
            nodes.addElement( original.substring(0, index) );
            original = original.substring(index+separator.length());
            index = original.indexOf(separator);
        }
        // Get the last node
        nodes.addElement( original );
        // Create splitted string array
        String[] result = new String[ nodes.size() ];
        if( nodes.size()>0 ) {
            for(int loop=0; loop<nodes.size(); loop++)
            {
                result[loop] = (String)nodes.elementAt(loop);
                System.out.println(result[loop]);
            }
        }
        return result;
    }

}
